<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/vue/2.6.9/vue.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.19.0/axios.min.js"></script>
    <link rel="stylesheet" href="static/css/css.css">
</head>
<body>
    <div id="app">
          <h2>{{tt}}</h2><br>
          <button @click="myPurchase()">我的荐购</button>
          <table>
              <tr>
                  <td>序号</td>
                  <td>题名</td>
                  <td>唯一订单号</td>
                  <td>印本ISSN</td>
                  <td>电子版ISSN</td>
                  <td>操作</td>
              </tr>
              <tr v-for="(it,index) in list">
                    <td>{{it.id}}</td>
                    <td>{{it.title}}</td>
                    <td>{{it.orderNumber}}</td>
                    <td>{{it.pissn}}</td>
                    <td>{{it.eissn}}</td> 
                    <td>
                        <button @click="agree(it.id)">同意</button>
                        <button @click="reject()">驳回</button>
                    </td> 
              </tr>
          </table>
    </div>
</body>
<script>
new Vue({
    el:"#app",
    data:{
        tt:"荐购审核页面",
        list:[]
    },
    created () {
         this.getData();
    },
    methods: {
        getData(){
            axios.get(`http://localhost:9004/purchase/querysPurchase`).then(res=>{
                 console.log(res);
                 this.list=res.data.data;
                 
            })
        },
        myPurchase(){
            location="mypurchaseList.html";
        },
        agree(rid){//修改这条数据的审核状态
             alert(rid);
             axios.get("http://localhost:9004/purchase/purchaseAgree?rid="+rid).then(res=>{
                   if(res.data.flag){
                        location="confirmPurchase.html";
                   }   
             })
        },
        reject(){//驳回  跳转到荐购列表
            location="purchaseList.html";

        }

    }




})



</script>
</html>